/**
 * 广寒宫
 * 网址:www.guanghangong.xyz
 */
package com.moon.admin;

import com.moon.admin.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 广寒宫-快速度开发版
 * @author moon
 */
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@EnableTransactionManagement
@ComponentScan(basePackages = {"com.moon.admin", "org.flowable.ui"})
@Slf4j
public class MoonBootApplication {
	
	public static void main(String[] args) throws Exception {
        SpringApplication.run(MoonBootApplication.class,args);
		System.err.println("请打开浏览器，访问  http://127.0.0.1:16001/swagger-ui.html");
	}

	@Autowired
    private com.moon.admin.framework.cache.CacheService cacheService;

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> {
            log.info("开始初始化系统...");
            cacheService.set("221", SysUserEntity.builder().userName("dasfdsfs").build());
            SysUserEntity str = cacheService.get("221",SysUserEntity.class);
            log.info("系统数据初始化...");
        };
    }
}